#ifndef GAMELOGICH_H
#define GAMELOGICH_H

#ifndef GRID_H
#include "../Grid/Grid.h"
#endif

#ifndef FACILITY_MANAGER_H
#include "../Facility/Facility_Manager.h"
#endif

#ifndef CARGO_MANAGER_H
#include "../Cargo/Cargo_Manager.h"
#endif

#ifndef MAP_DATA_MANAGER_H
#include "../Grid/map_data_manager.h"
#endif

#ifndef DATA_MANAGER_H
#include "../utils/data_manager.h"
#endif

#ifndef PAINT_SYSTEM_H
#include "../PaintSystem/paint_system.h"
#endif

class GameLogic
{
    friend class Game_Scene;
public:
    GameLogic(const Data_Manager *data_manager,PaintSystem *paint_system); // 默认函数是 新游戏
    ~GameLogic();
protected:
    void logic_update();
    Facility* tryToPlaceFacility(FacilityType f_type, FacilityDirection f_dir, int group_idx, const Coordinate &co);
    void tryToRemoveFacility(const Coordinate &co);
    void setupGrid();
    void do_save();
    void load_save();
private:
    Grid * grid;
    Facility_Manager * facility_manager = null;
    Cargo_Manager * cargo_manager = null;
    PaintSystem * paint_system = null;
    // Map_Data_Manager *map_data_manager = null;
    const Data_Manager *data_manager = null;
};

#endif
